package com.hy.chanping.product.core.user.services;

import com.cqsudu.lightning.service.core.Result;
import com.cqsudu.lightning.service.exception.ApiNotSupportException;
import com.hy.chanping.product.core.user.dtos.SimpleUser;
import com.hy.chanping.product.core.user.dtos.User;
import com.hy.chanping.product.core.user.dtos.UserCreate;
import org.springframework.lang.Nullable;
import org.springframework.validation.annotation.Validated;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;

@Validated
public interface UserService {

    /**
     * 查找一个
     *
     * @param id 主键
     * @return 用户简单对象
     */
    default SimpleUser findOne(@NotNull(message = "id is required") Long id) {
        throw ApiNotSupportException.getInstance();
    }

    /**
     * 根据id查找
     *
     * @param ids 主键集合
     * @return 用户简单对象
     */
    default List<SimpleUser> findSimpleByIds(@NotEmpty(message = "ids is required") List<Long> ids) {
        throw ApiNotSupportException.getInstance();
    }

    /**
     * 创建用户
     *
     * @param user
     * @return
     */
    default Long create(@Valid @NotNull(message = "user is required") UserCreate user) {
        throw ApiNotSupportException.getInstance();
    }

    /**
     * 分页列表
     *
     * @param name 名称
     * @param page 页码 从0开始
     * @param size 每页条数
     * @return 分页结果
     */
    default Result<User> page(@Nullable String name, @NotNull Integer page, @NotNull Integer size) {
        throw ApiNotSupportException.getInstance();
    }
}
